package day03;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class T3 {

	public static void main(String[] args) {
		ExecutorService poo=Executors.newFixedThreadPool(3);
		for(int i=0;i<10;i++) {
			//将任务交给线程池,随机指派一个线程对象来执行
			//Future submit(Callable/Runnable)
			poo.execute(new Runnable() {

				@Override
				public void run() {
					for(int i=0;i<10;i++) {
						System.out.println(Thread.currentThread().getName()+":"+i);
						try {
							Thread.sleep(5000);
						} catch (InterruptedException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						}
					}
					
				}
				
			});
			
			
		}
		poo.shutdown();
	}

}
